---
title: Configuration.encodeMQTT()
api: Configuration.encodeMQTT
---

## Description

<Summary/>

<FilterDiagram
  name="encodeMQTT"
  input="Message"
  output="Data"
/>

The encoder expects an input [Message](/reference/api/Message) to have:

* _head_
  - _type_ - Type of the packet such as _"SUBSCRIBE"_ and _"PUBLISH"_
  - _qos_ - PUBLISH Quality of Service
  - _dup_ - Duplicate delivery of a PUBLISH packet
  - _retain_ - PUBLISH retained message flag
  - Other properties defined in the [specification](https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901027)
* _body_ - Payload of a PUBLISH packet

## Syntax

``` js
pipy()
  .pipeline()
  .encodeMQTT()
```

## Parameters

<Parameters/>

## See Also

* [Configuration](/reference/api/Configuration)
* [decodeMQTT()](/reference/api/Configuration/decodeMQTT)
